package com.hotel.mapper;

import com.hotel.domain.VipUser;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
@Mapper
public interface VipUserMapper {

    @Results({
            @Result(property = "vid", column = "vid"),
            @Result(property = "vname", column = "vname"),
            @Result(property = "rank", column = "rank"),
            @Result(property = "sex", column = "sex"),
            @Result(property = "phone", column = "phone"),
            @Result(property = "balance", column = "balance"),
            @Result(property = "integral", column = "integral")
    })

    //查询全部会员信息
    @Select("select * from vip_user")
    List<VipUser> selectAllVipUser();

    //查询单个会员信息
    @Select("select * from vip_user where vid=#{vid}")
    VipUser selectByVid(int vid);

    //添加会员
    @Insert("insert into vip_user(vid,vname,rank,sex,phone,balance,integral)values(#{vipId},#{vipName},#{rank},#{sex},#{phone},#{balance},#{integral})")
    int addVipUser(VipUser vipUser);

    //修改会员信息
    @Update("update vip_user set vname=#{vname},rank=#{rank},sex=#{sex},phone=#{phone},balance=#{balance},integral=#{integral} where vid=#{vid}")
    int modifyVipUser(VipUser vipUser);

}